<?php
namespace App\Modules\Message;
use App\Modules\AdapterApi;
use App\Services\Message\MessageIndex;
/**
 * Created by PhpStorm.
 * User: 97606
 * Date: 2018/6/12
 * Time: 10:10
 */
class Message extends AdapterApi
{
    
    /*一对一发送站内信*/
    public function sendOneMessage(): array 
    {
        $data = pick_array($this->postData, ['from_uid','to_uid','title','content','type','orther_info']);
        return MessageIndex::Message()->sendOneMessage($data);
    }

    /*一对多发送站内信*/
    public function sendBatchMessage(): array 
    {
        $data = pick_array($this->postData, ['from_uid','to_uid','title','content','type','orther_info']);
        return MessageIndex::Message()->sendBatchMessage($data);
    }

    /*管理员查看某站内信详情*/
    public function adminMessageDetail(): array 
    {
        $data = pick_array($this->postData, ['id']);
        return MessageIndex::Message()->adminMessageDetail($data);
    }

     /*管理员查看某用户的收件箱、发件箱*/
    public function adminMessageList(): array 
    {
        $data = pick_array($this->postData, ['user_id','page','listRows','keywords']);
        return MessageIndex::Message()->adminMessageList($data);
    }
    /*查看某用户的收件箱、发件箱*/
    public function messageList(): array
    {
        $data = pick_array($this->postData, ['user_id','msgType']);
        return MessageIndex::Message()->messageList($data);
    }

    /*回复某个站内信*/
    public function replyOneMessage(): array 
    { 
        $data = pick_array($this->postData, ['id','user_id','content','orther_info']);
        return MessageIndex::Message()->replyOneMessage($data);
    }
    
    /*管理员删除某个站内信*/
    public function adminDelOneMessage(): array 
    {
        $data = pick_array($this->postData, ['id']);
        return MessageIndex::Message()->adminDelOneMessage($data);

       /* $data = $this->receiveData(['id'=>0]);
        return $this->oneStepRun($data, 'servermessage/message/Message/adminDelOneMessage', 'adminDelOneMessage');*/
    }

    /*管理员批量删除某个站内信*/
    public function adminDelBatchMessage(): array 
    {

        $data = pick_array($this->postData, ['id']);
        return MessageIndex::Message()->adminDelBatchMessage($data);
        
        /*$data = $this->receiveData(['id'=>[]]);
        return $this->oneStepRun($data, 'servermessage/message/Message/adminDelBatchMessage', 'adminDelBatchMessage');*/
    }
}
